<?xml version="1.0" encoding="UTF-8"?>

<!--

(From http://www.w3.org/2005/rules/wiki/BLD#XML_for_the_RIF-BLD_Condition_Language)


Example 5 (A RIF condition with named arguments and its XML serialization).

Compact URI prefixes:

  bks  expands into http://example.com/books#
  auth expands into http://example.com/authors#
  cpt  expands into http://example.com/concepts#
  curr expands into http://example.com/currencies#

a. RIF condition:

   And (Exists ?Buyer ?P (
                 And (?P#"cpt:purchase"^^rif:iri
                      ?P["cpt:buyer"^^rif:iri->?Buyer
                         "cpt:seller"^^rif:iri->?Seller                                      
                         "cpt:item"^^rif:iri->"cpt:book"^^rif:iri
                         "cpt:price"^^rif:iri->"49"^^xs:integer
                         "cpt:currency"^^rif:iri->"curr:USD"^^rif:iri]))
        ?Seller=?Author)

b. XML serialization:

-->

<!DOCTYPE Document [
  <!ENTITY bks "http://example.com/books#">
  <!ENTITY cpt "http://example.com/concepts#">
  <!ENTITY curr "http://example.com/currencies#">
  <!ENTITY ppl "http://example.com/people#">
  <!ENTITY dc  "http://purl.org/dc/terms/">
  <!ENTITY w3  "http://www.w3.org/">
  <!ENTITY rif "http://www.w3.org/2007/rif#">
  <!ENTITY op  "http://www.w3.org/2007/rif-builtin-predicate#">
  <!ENTITY fn  "http://www.w3.org/2007/rif-builtin-function#">
  <!ENTITY xs  "http://www.w3.org/2001/XMLSchema#">
]>

   <And
    xmlns="http://www.w3.org/2007/rif#"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xs="http://www.w3.org/2001/XMLSchema#">
     <formula>
       <Exists>
         <declare><Var>Buyer</Var></declare>
         <declare><Var>P</Var></declare>
         <formula>
           <And>
             <formula>
               <Member>
	         <id>
                   <Const type="&rif;iri">http://sample.org/Member</Const>
                 </id>
                 <instance><Var>P</Var></instance>
                 <class><Const type="&rif;iri">&cpt;purchase</Const></class>
               </Member>
             </formula>
             <formula>
               <Frame>
                 <object>
                   <Var>P</Var>
                 </object>
                 <slot ordered="yes">
                   <Const type="&rif;iri">&cpt;buyer</Const>
                   <Var>Buyer</Var>
                 </slot>
                 <slot ordered="yes">
                   <Const type="&rif;iri">&cpt;seller</Const>
                   <Var>Seller</Var>
                 </slot>
                 <slot ordered="yes">
                   <Const type="&rif;iri">&cpt;item</Const>
                   <Const type="&rif;iri">&cpt;book</Const>
                 </slot>
                 <slot ordered="yes">
                   <Const type="&rif;iri">&cpt;price</Const>
                   <Const type="&xs;integer">49</Const>
                 </slot>
                 <slot ordered="yes">
                   <Const type="&rif;iri">&cpt;currency</Const>
                   <Const type="&rif;iri">&curr;USD</Const>
                 </slot>
               </Frame>
             </formula>
           </And>
         </formula>
       </Exists>
     </formula>
     <formula>
       <Equal>
         <left><Var>Seller</Var></left>
         <right><Var>Author</Var></right>
       </Equal>
     </formula>
   </And>
